//khai bao thu vien
#include<conio.h>
#include<stdio.h>
void main()
{
	//khai bao bien
	int n,i,j,p,t;
	//xoa man hinh
	clrscr();
	//Nhap lai neu du lieu khong dung
	Nhaplai:
	{
		clrscr();
		printf("\n\tCT TINH TONG CAC CHU SO CUA MOT SO NGUYEN ");
		printf("\n\tNhap so nguyen co toi da 3 chu so:");
		scanf("%d",&n);
	}
	//Nhap lai neu la so co 4 chu so
	if (n>999)
		goto Nhaplai;
	//Tim tong cac chu so cua so nguyen
	i=n/100;
	j=(n-i*100)/10;
	p=(n-i*100-j*10);
	t=i+j+p;
	// in ra ket qua
	printf("\n\tTong cac chu so la:%d",t);
	getch();
}
